package game.gfx;

import java.awt.Color;

public class ColoredChar implements Cloneable
{
    private char  c;
    private Color foreground;
    private Color background;
    
    public ColoredChar(char c, Color foreground, Color background)
    {
        this.c = c;
        this.foreground = foreground;
        this.background = background;
    }
    
    public ColoredChar(char c, ConsoleColor color)
    {
        this(c, color.getForeground(), color.getBackground());
    }

    public char getChar()
    {
        return c;
    }

    public void setChar(char c)
    {
        this.c = c;
    }
    
    public Color getForeground()
    {
        return foreground;
    }

    public void setForeground(Color foreground)
    {
        this.foreground = foreground;
    }

    public Color getBackground()
    {
        return background;
    }

    public void setBackground(Color background)
    {
        this.background = background;
    }

    public void setConsoleColor(ConsoleColor c)
    {
        this.foreground = c.getForeground();
        this.background = c.getBackground();
    }
    
    public ConsoleColor getConsoleColor()
    {
        return new ConsoleColor(foreground, background);
    }
    
    public boolean isConsoleColor(ConsoleColor color)
    {
        return getConsoleColor().equals(color);
    }
    
    @Override
    public ColoredChar clone()
    {
        return new ColoredChar(c, foreground, background);
    }
}
